import React,{lazy} from "react";
import {
  AppOutline,
  MessageOutline,
  UnorderedListOutline,
  UserOutline,
} from 'antd-mobile-icons'
import {Navigate} from 'react-router-dom'

let MainLayout = lazy(()=>import('../pages/mainLayout'))
let Home = lazy(()=>import('../pages/home'))
let Order = lazy(()=>import('../pages/order'))
let Message = lazy(()=>import('../pages/message'))
let My = lazy(()=>import('../pages/my'))

export const homeRoutes = [
    {
        path:'/home',
        element:<Home></Home>,
        title:'首页',
        icon:<AppOutline />
    },
    {
        path:'/message',
        element:<Message></Message>,
        title:'消息',
        icon:<MessageOutline />
    },
    {
        path:'/order',
        element:<Order></Order>,
        title:'订单',
        icon:<UnorderedListOutline />
    },
    {
        path:'/my',
        element:<My></My>,
        title:'我的',
        icon:<UserOutline />
    },
]

export const routes = [
    {
        path:'/',
        element:<MainLayout></MainLayout>,
        children:[
            ...homeRoutes,
            {
                path:'/',
                element:<Navigate to='/home'></Navigate>
            }
        ],
    }
]